 <!doctype html>
 <html lang="en">
 <head>
     <meta charset="UTF-8">
     <title>学生信息</title>
     <load href="__PUBLIC__/bootstrap/js/jquery-1.8.3.min.js"/>
     <load href="__PUBLIC__/bootstrap/js/bootstrap.js" />
     <load href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css"/>
     <script>
        $(function(){
            $(".menu li").hover(function(){
                var i = $(this).index();
                $(this).addClass('active').siblings().removeClass('active');
                $('.content>div').eq(i).show().siblings().hide();
            });
        })
     </script>
     <script>
        $(function(){
           $(".xx").click(function(){
            var i = $(this).parent().siblings().eq(0).text();
            alert(i);
            var r = confirm("确认删除吗？");
            if(r==true)
            {   
                var url="__APP__/Home/Index/del2/id/"+i+".html";
                window.location.href=url;
            }
           })
        })
     </script>

    <script>
        $(function(){
            var p=1;
            $(".next").click(function(){
                
                p++;
                $.get("{:U('index')}",{p:p},
                    function(data){
                        if(data.errCode!=0){
                            $(".success").nextAll().remove();
                            $(".success").after(data.data);
                        }else{
                            p++;
                        }
                    });
            })
        })
        
        $(".pager li").eq(1).click(function(){
            p++;
            $.get("{:U('index')}",{p:p},
                function(data){
                    if(data.errCode!=0){
                        $(".success").nextAll().remove();
                        $(".success").after(data.data);
                    }else{
                        p--;
                    }
                });
        })
    </script>

     <style>
        .liuyan{
            display:none;
        }
        .denglu{
            display: none;
        }
        .liuyanid{
            display:none;
        }
     </style>
 </head>
 <body>
    <div class="box">
    <ul class="menu nav nav-tabs">
    <li class="active"><a href="#">学生信息表</a></li>
    <li><a href="#">留言板</a></li>
    <li><a href="#">登录</a></li>
    </ul>
    <div class="content">
    <!-- 学生信息表 -->
    <div classs="student">
        <!-- 学生信息查询 -->
        <form action="{:U('Home/Index/index')}" method="get" class="form-inline" role="form">
            <div class="form-group col-md-3">姓名：
              <label class="sr-only" for="exampleInputEmail2">姓名</label>
              <input type="text" class="form-control" id="exampleInputEmail2" placeholder="name" name="name">
            </div>
             <div class="form-group col-md-3">年龄：
             <div class="input-group col-md-5 ">
                <input name="min" class="form-control " type="text" placeholder="最小年龄">
              </div>
              <div class="input-group col-md-5">
                <input name="max" class="form-control " type="text" placeholder="最大年龄">
              </div>
            </div>
            <div class="form-group col-md-2">性别：
              <label class="sr-only" for="exampleInputPassword2">性别</label>
              <input type="radio" class="form-control" name="sex" id="optionsRadios1" value="男" >男
              <input type="radio" class="form-control" name="sex" id="optionsRadios2" value="女" >女
            </div>
            <div class="form-group col-md-2">班级：
              <label class="sr-only" for="exampleInputPassword2">班级</label>
              <select class="form-control" name="class">
                 <option value="">所有</option>
                 <option value="1">1班</option>
                 <option value="2">2班</option>
                 <option value="3">3班</option>
              </select>
            </div>
            <div class="form-group col-md-1">
            <input type="submit" class="btn btn-default" value="查询">
            </div>
        </form>
     <!-- 学生信息表 -->
     <table class="table table-hover">
     <tr class="success">
        <th>编号</th>
         <th>姓名</th>
         <th>班级</th>
         <th>性别</th>
         <th>年龄</th>
         <th>操作</th>
     </tr>
     <foreach name="res" item="v">
     <tr>
         <td>{$v.id}</td>
         <td>{$v.name}</td>
         <td>{$v.class}</td>
        <td>{$v.sex}</td>
         <td>{$v.age}</td>
         <td><a href="{:U('Index/update',array('id'=>$v['id']))}">编辑</a>/
         <a href="#" class="dd">删除</a></td>
     </tr>
     </foreach>         
     </table>
       
        <ul class="pager">
            <li><a class="prev" href="javascript:void(0)">上一页</a></li>
            <li><a class="next" href="javascript:void(0)">下一页</a></li>
        </ul>
         {$show}
     <!-- 添加学生信息 -->
     <form action="{:U('Home/Index/add')}" method="post">
         姓名：<input type="text" name="name"><br>
         班级：
         <select name="class">
             <option value="1">1班</option>
             <option value="2">2班</option>
             <option value="3">3班</option>
         </select><br>
         性别：
         <select name="sex">
             <option value="男">男</option>
             <option value="女">女</option>
         </select><br>
         年龄：<input type="text" name="age"><br>
         <input type="submit" value="提交">
     </form>
     </div> 
     <!-- 留言板 -->
    <div class="liuyan">
    
        <foreach name="liuyan" item="v">
            <div class="panel panel-default col-md-4 col-md-offset-1">
                <div class="panel-heading">
                    <h3 class="liuyanid">{$v.id}</h3>
                    <h3 class="panel-title">
                        {$v.title}
                        <span style="float:right;color:#ccc;cursor:pointer" class="xx">X</span>
                    </h3>

                </div>
                <div class="panel-body">
                    {$v.content}
                </div>
                <div class="panel-footer">
                    {$v.time}from:{$v.user}
                </div>

            </div>  
        </foreach>  

    </div>
     
     <!-- 登陆 -->
     <div class="denglu">
         dengludfh
     </div>

     </div>
     </div>
     <script>
        $(".dd").click(function(){
            var i = $(this).parent().siblings().eq(0).text();
            //alert(i);
            var r = confirm("确认删除吗？");
            
            if(r==true)
            {   
                var url="__APP__/Home/Index/del/id/"+i+".html";
                window.location.href=url;
            }
        })
     </script>
 </body>
 </html>